Certified Java Programmer Mock Exam


Question 1


1.  class Basics1 {
2.    public static void main(String[] args) {}
3.  }
4.  class Basics2 {
5.    public static void main(String []args) {}
6.  }
7.  class Basics3 {
8.    public static void main(String args[]) {}
9.  }

What is the result of attempting to compile and run the above programs?

a. Compiler error at line 2.
b. Compiler error at line 5.
c. Compiler error at line 8.
d. Run time error at line 2.
e. Run time error at line 5.
f. Run time error at line 8.
g. None of the Above

Question 2


class Basics {
  public static void main (String[] args) {
    int x;
    int y;
    int z;
    System.out.println(x+y+z);
  }
}

What is the result of attempting to compile and run the above program?

a. Prints nothing.
b. Prints an undefined value.
c. Prints: null
d. Prints: 0
e. Run time Exception
f. Compiler Error
g. None of the Above

Question 3


Which of these words belong to the set of java keywords?

a. next
b. catch
c. function
d. instanceof
e. mod
f. const
g. or
h. Boolean
i. goto
j. import
k. transient
l. None of the Above

Question 4

class Blue {
  public static void main (String[] args) {
    String s = null;
    System.out.print(s);
  }
}

What is the result of attempting to compile and run the program?

a. Prints nothing.
b. Prints: null
c. Compiler error
d. Runtime error
e. None of the Above

Question 5


Which of these words belong to the set of java keywords?

</
a. declare
b. global
c. const
d. preserve